<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>typewriter打字机css</title>
    <style>
      .container {
        display: inline-block;
      }
      .typewriter {
        overflow: hidden;
        border-right: 0.15em solid orange;
        white-space: nowrap;
        animation: typing 1s steps(20, end) forwards;
        font-size: 1.6rem;
        width: 0;
      }
      @keyframes typing {
        from {
          width: 0;
        }
        to {
          width: 100%;
        }
      }
    </style>
  </head>
  <body>
    <div class="container">
      <div class="typewriter">这是typewriter打字机css~</div>
    </div>
  </body>
</html>
